package com.cloudsigns.factorymanager2.engineering.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.cloudsigns.factorymanager2.R;

import com.cloudsigns.factorymanager2.engineering.bean.EngineeringConstructContentBean;
import com.cloudsigns.factorymanager2.project.adapter.ViewConstructContentAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 工程 工单管理 分派工单 工程施工 查看施工内容
 * Created by tony on 2018/2/2.
 */

public class ViewConstructContentActivity extends Activity implements View.OnClickListener {
    private ImageView img_back;
    private TextView tv_title;
    private ListView lv;
    private ViewConstructContentAdapter adapter;
    private List<EngineeringConstructContentBean> datas = new ArrayList<>();
    private final String TAG = ViewConstructContentActivity.class.getSimpleName();
    private List<String> selectedItemList = new ArrayList<String>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        // 沉浸式状态栏
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                    );
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);

        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        setContentView(R.layout.layout_view_construct_content);

        init();
    }

    private void init() {
        img_back = findViewById(R.id.img_back);
        tv_title = findViewById(R.id.tv_title);

        lv = findViewById(R.id.lv);


        tv_title.setText(getResources().getText(R.string.view_add_status));
        img_back.setOnClickListener(this);

//
//        datas.add(new EngineeringConstructContentBean("准备施工队伍", "2017-05-21", "2017-05-27", true));
//        datas.add(new EngineeringConstructContentBean("现场安装基础制作", "2017-05-21", "2017-05-27"));
//        datas.add(new EngineeringConstructContentBean("安装基础检验", "2017-05-21", "2017-05-27"));
//        datas.add(new EngineeringConstructContentBean("安装点位确认", "2017-05-21", "2017-05-27", true));
//        datas.add(new EngineeringConstructContentBean("相关手续或许可办理", "2017-05-21", "2017-05-27", true));
//        datas.add(new EngineeringConstructContentBean("现场接货验收", "2017-05-21", "2017-05-27", true));
//        datas.add(new EngineeringConstructContentBean("现场产品管理", "2017-05-21", "2017-05-27"));
//        datas.add(new EngineeringConstructContentBean("施工设备租赁", "2017-05-21", "2017-05-27"));
//        datas.add(new EngineeringConstructContentBean("联系现场安装设备入场", "2017-05-21", "2017-05-27"));
//        datas.add(new EngineeringConstructContentBean("现场制作内容的进度", "2017-05-21", "2017-05-27"));
//        datas.add(new EngineeringConstructContentBean("安装进度", "2017-05-21", "2017-05-27"));
//
//        Intent mIntent = getIntent();
//        if (mIntent != null) {
//            selectedItemList = (List<String>) mIntent.getSerializableExtra(ConstantUtil.KEY_1);
//            for (String posStr : selectedItemList) {
//                int positon = Integer.parseInt(posStr);
//                datas.get(positon).setChecked(true);
//            }
//
//        }

        adapter = new ViewConstructContentAdapter(this, TAG);
        adapter.setData(datas);
        lv.setAdapter(adapter);


    }

    @Override
    public void onClick(View view) {
        TextView tv;
        Intent mIntent;
        switch (view.getId()) {
            case R.id.img_back:
                finish();
                break;

        }
    }
}
